﻿using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Apps.Core;
using Unity;
using Apps.Web.App_Start;

namespace Apps.Web
{
	public class MvcApplication : System.Web.HttpApplication
	{
		protected void Application_Start()
		{
			AreaRegistration.RegisterAllAreas();

			WebApiConfig.Register(GlobalConfiguration.Configuration);

			FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
			RouteConfig.RegisterRoutes(RouteTable.Routes);

			//启用压缩
			BundleTable.EnableOptimizations = true;
			BundleConfig.RegisterBundles(BundleTable.Bundles);

			//注入
			var container = new UnityContainer();
			DependencyRegisterType.Container_Sys(ref container);
			DependencyResolver.SetResolver(new UnityDependencyResolver(container));
		}
	}
}
